Remove glob dependency
authorYehuda Katz <wycats@gmail.com>
Tue, 8 Jul 2014 04:50:45 +0000 (21:50 -0700)
committerYehuda Katz <wycats@gmail.com>
Tue, 8 Jul 2014 05:23:07 +0000 (22:23 -0700)
src/cargo/lib.rs
src/cargo/util/toml.rs

index 0982ed96f4fbafb38e43d205e14b0d5861213cf8..32a07fd9c1311e619eca3a47608b998c4dc13ac9 100644 (file)
@@ -8,7 +8,6 @@ extern crate term;
 extern crate url;
 extern crate serialize;
 extern crate semver;
-extern crate glob;
 extern crate toml;
 
 #[phase(plugin, link)]
index 59fba60d8364467917efa786f1fa36453a7663f2..559fde781560c08a2aee95c4b3f7f52dc5123121 100644 (file)
@@ -1,9 +1,9 @@
 use serialize::Decodable;
 use std::collections::HashMap;
 use std::str;
+use std::io::fs;
 use toml;
 
-use glob::glob;
 use core::{SourceId, GitKind};
 use core::manifest::{LibKind, Lib, Profile};
 use core::{Summary, Manifest, Target, Dependency, PackageId};
@@ -39,10 +39,11 @@ pub fn project_layout(root: &Path) -> Layout {
         bins.push(root.join("src/main.rs"));
     }
 
-    // TODO: glob takes a &str even though Paths may have non-UTF8 chars. This
-    // seems like a bug in libglob
-    let found = glob(root.join("src/bin/*.rs").display().to_str().as_slice()).collect();
-    bins.push_all_move(found);
+    fs::readdir(&root.join("src/bin"))
+        .map(|v| v.move_iter())
+        .map(|i| i.filter(|f| f.extension_str() == Some("rs")))
+        .map(|mut i| i.collect())
+        .map(|found| bins.push_all_move(found));
 
     Layout {
         lib: lib,